/**
 * 
 */
package org.cuatrovientos.loopsexercise6;

import java.util.Scanner;

/**
 * @author javier_basallo
 *Calculate a factorial
 */
public class LoopsExercise6 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		//1. definir variables
		String line = "";
		int number = 0;
		int result = 1;
		Scanner reader = new Scanner (System.in);
				
		//2. Solicitar al ususario un numero
		System.out.println("Enter a number: ");
		line = reader.nextLine();
				
		//3. Convertir a entero
		number = Integer.parseInt(line); 
		
		//4. Calcular el factorial
		
		for (int i=number; i>1; i--){
			result = result * i;
		}
		
		System.out.println("Factorial: "+ result);

	}

}
